/*
 * Copyright 2009 Jinbo Lin. All rights reserved.
 * 
 * cn.edu.pku.util HumanResourcesManagementSystem
 *
 * Created on 2009-12-22
 */
package cn.edu.pku.util;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate3.HibernateTemplate;

/**
 * @author Jinbo Lin
 * 
 * 
 */
public abstract class MyBeanFactory {

	public static HibernateTemplate getHibernateTemplate() {
		Resource resource = new ClassPathResource("applicationContext.xml");
		BeanFactory factory = new XmlBeanFactory(resource);
		HibernateTemplate hibernateTemplate = (HibernateTemplate) factory
				.getBean("hibernateTemplate");
		return hibernateTemplate;
	}

	/**
	 * @param args
	 */
	// public static void main(String[] args) {
	// UserDaoHibernate ud = new UserDaoHibernate();
	// ud.setHibernateTemplate(MyBeanFactory.getHibernateTemplate());
	//		
	// System.out.println(ud.findUserIdByUserName("ljb"));
	// }
}
